<?php

namespace App\Http\Controllers\user;

use App\Dao\AreaDao;
use App\Dao\OlisDao;
use App\Dao\UsersDao;
use App\Exceptions\SysExceptions;
use App\Services\Code;

class UsersController extends BaseController
{
    public function login(): array
    {
        $params = request()->all();
        return Code::message('',200,UsersDao::login($params));
    }


    public function user_info(): array
    {
        $params = [
            'user_id'=>getUserToken()
        ];
        return Code::message('',200,UsersDao::user_info($params));
    }

    /**
     * @throws SysExceptions
     */
    public function set_pay_pass(): array
    {
        $params = array_merge(request()->all(),[
            'user_id'=>getUserToken()
        ]);
        UsersDao::set_pay_pass($params);
        return Code::message('',200);
    }

    public function user_send_oli(): array
    {
        $params = array_merge(request()->all(),[
            'user_id'=>getUserToken()
        ]);
        OlisDao::send_oli($params);
        return Code::message('',200);
    }


    public function user_spreads(): array
    {
        $params = array_merge(request()->all(),[
            'spread_id'=>getUserToken()
        ]);
        return Code::message('',200,UsersDao::spreads($params));
    }

    public function balance_zhu_transfer(): array
    {
        $params = array_merge([
            'user_id'=>getUserToken()
        ],request()->all());

        UsersDao::balance_zhu_transfer($params);
        return Code::message(';',200);
    }

    public function write_off(): array
    {
        $params = array_merge(request()->all(),[
            'user_id'=>getUserToken()
        ]);
        UsersDao::write_off($params);
        return Code::message('',200);
    }
}
